package jmvcclab.View;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class NumPanel extends JPanel implements ActionListener {
    public static JButton[] nums;
    private CalcForm calcForm;
    public NumPanel(){
        this.setLayout(new GridLayout(4,3, 10, 10));
        nums = new JButton[13];

        for (Integer i=1; i<10; i++) {
            nums[i]=new JButton(i.toString());
            nums[i].addActionListener(this);
        }

        nums[10] = new JButton("CE");
        nums[10].setBackground(Color.red);
        nums[10].setForeground(Color.white);
        nums[10].setBorderPainted(false);
        nums[10].addActionListener(this);

        nums[11] = new JButton("0");
        nums[11].addActionListener(this);

        nums[12] = new JButton(",");
        nums[12].addActionListener(this);

        for (Integer i=1; i<13; i++) {
            this.add(nums[i]);
        }
    }

    public void actionPerformed(ActionEvent e){
        String command = e.getActionCommand();
        IOPanel.text.setText(command);
    }
    
}
